'''

buddy
'''

import sys
from PyQt5.QtWidgets import *

class QLabelBuddy(QDialog):
    def __init__(self):
        super(QLabelBuddy, self).__init__()
        self.initUI()
    def initUI(self):
        self.setWindowTitle('Qlabel buddy')
        nameLable = QLabel('&Name', self)
        nameLineEdit = QLineEdit(self)
        nameLable.setBuddy(nameLineEdit)

        passwordLable = QLabel('&Password', self)
        passwordLineEdit = QLineEdit(self)
        passwordLable.setBuddy(passwordLineEdit)

        btnOk = QPushButton("&OK")
        btnCancel = QPushButton("&Cancel")

        mainLayput = QGridLayout(self)
        mainLayput.addWidget(nameLable, 0, 0)
        mainLayput.addWidget(nameLineEdit, 0, 1, 1, 2)

        mainLayput.addWidget(passwordLable, 1, 0)
        mainLayput.addWidget(passwordLineEdit, 1,1, 1, 2)

        mainLayput.addWidget(btnOk, 2, 1)
        mainLayput.addWidget(btnCancel, 2, 2)
        '''
        mainLayput.addWidget(控件对象， rowIndex, columIndex, row, colcum)
        '''
if __name__ == '__main__':

    app = QApplication(sys.argv)
    ex = QLabelBuddy()
    ex.show()

    sys.exit(app.exec_())